#include <REGX52.H>

void Delay(unsigned int xms)		//@11.0592MHz
{
	unsigned char i, j;
	while(xms--)
	{
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}
}


void main()
{
	EA=1;		//总中断打开
	EX0=1;
	EX1=1;	//	允许中断0、1中断
	IT0=1;
	IT1=1;	//中断0、1设置下降沿中断
	IP=0;		//中断优先级控制寄存器低（可位寻址）
	
	while(1)
	{
		P2=0xFE;//1111 1110
		Delay(500);
		P2=0xFD;//1111 1101
		Delay(500);
		P2=0xFB;//1111 1011
		Delay(500);
		P2=0xF7;//1111 0111
		Delay(500);
		P2=0xEF;//1110 1111
		Delay(500);
		P2=0xDF;//1101 1111
		Delay(500);
		P2=0xBF;//1011 1111
		Delay(500);
		P2=0x7F;//0111 1111
		Delay(500);		
	}
}

	
void Int0_Routine() interrupt 0
{
	unsigned char i;
	for(i=0;i<10;i++)
	{
		P2=0xf0;
		Delay(300);
		P2=0x0f;
		Delay(300);
	}
}

void Int1_Routine() interrupt 2
{	
			unsigned char i;
			for(i=0;i<10;i++)
			{
				P2=0xff;
				Delay(300);
				P2=0x00;
				Delay(300);
			}
}
	
	
	